<html>
<head><meta charset="utf-8"><title>Backtrace confusion · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Backtrace.20confusion.html">Backtrace confusion</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="182854305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Backtrace%20confusion/near/182854305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Backtrace.20confusion.html#182854305">(Dec 07 2019 at 17:40)</a>:</h4>
<p>I'm currently trying to debug an assertion failure. The assertion is in <code>src/librustc_mir/interpret/place.rs:881:9</code> (as shown in the panic message), but the backtrace printed does not include that function (<code>copy_op_no_validate</code>). Any ideas how this is possible? I guess I can manually print the backtrace at the time of assertion failure (using the <code>std::backtrace</code>) but I wonder why the default backtrace doesn't have the actual failing function.</p>



<a name="182855355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Backtrace%20confusion/near/182855355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Backtrace.20confusion.html#182855355">(Dec 07 2019 at 18:08)</a>:</h4>
<p>You need to turn on debug-assertions in config.toml. copy config.toml.example and edit it by uncommenting and changing the value of debug-assertions</p>



<a name="182855358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Backtrace%20confusion/near/182855358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Backtrace.20confusion.html#182855358">(Dec 07 2019 at 18:08)</a>:</h4>
<p>(I think, read the docs on that flag)</p>



<a name="182901596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Backtrace%20confusion/near/182901596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Backtrace.20confusion.html#182901596">(Dec 08 2019 at 17:40)</a>:</h4>
<p>Likely it happened because inlining removed the function in question ;)</p>



<a name="182929688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Backtrace%20confusion/near/182929688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Backtrace.20confusion.html#182929688">(Dec 09 2019 at 07:16)</a>:</h4>
<p>But I see the expected backtrace if I print <code>std::backtrace::Backtrace</code> in the panic message. So the backtrace shown in <code>assert!(..., "{}", std::backtrace::Backtrace::capture())</code> has <code>copy_op_no_validate</code>) but the backtrace shown by the panic handler does not.</p>



<a name="183157692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Backtrace%20confusion/near/183157692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edd Barrett <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Backtrace.20confusion.html#183157692">(Dec 11 2019 at 13:46)</a>:</h4>
<p><span class="user-mention" data-user-id="119169">@osa1</span> It's likely what @oli said above.</p>
<p>The default backtraces are not precise by default. </p>
<p>I remember being confused by this when I first started out. As mentioned above, take a look at <code>debug</code> and <code>debuginfo-level</code> in <code>config.toml.example</code>.</p>
<p>To have accurate traces I think you need <code>debuginfo-level</code> to be at least 1.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>